home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / lib / mntc6846.zoo / patch / sfutosf.s < prev    next >
Encoding:
Text File  |  1994-11-14  |  1.1 KB  |  36 lines

  1.  ! C68 32 bit unsigned => 4-byte-floating point conversion routine
  2.  !-----------------------------------------------------------------------------
  3.  ! ported to 68000 by Kai-Uwe Bloem, 12/89
  4.  !  #1  original author: Peter S. Housel 3/28/89
  5.  !  #2  Redid register usage, and then added wrapper routine
  6.  !    to provide C68 IEEE compatibility    Dave & Keith Walker    02/92
  7.  !  #3  Changed entry/exit code for C68 v4.3 compatibility
  8.  !    Removed ACK entry point                        09/93
  9.  !-----------------------------------------------------------------------------
  10.  
  11. BIAS4    =    0x7F - 1
  12.  
  13.     .sect .text
  14.  
  15.     .define    .Xsfutosf
  16.  
  17. !----------------------------------------
  18. !    sp    Return address
  19. !    sp+4    address of result
  20. !    sp+8    Value to convert
  21. !----------------------------------------
  22. .Xsfutosf:
  23.     move.l    4(sp),a1    ! address for result
  24.     move.l    8(sp),d1    ! value to convert
  25.  
  26.     move.w    #BIAS4+32-8,d0    ! radix point after 32 bits
  27.     clr.w    d2        ! sign is always positive 
  28.     move.l    d1,(a1)        ! write mantissa onto stack
  29.     clr.w    d1        ! set rounding = 0
  30.     jsr    .Xnorm4
  31.  
  32.     move.l    (sp)+,a0    ! get return address
  33.     add.l    #8,sp        ! remove parameters from stack
  34.     jmp    (a0)        ! ... and return
  35.  
  36.